{extend name="v1/layout/base"}
{block name="content"}
<div class="layui-row layui-col-space15">
  <div class="layui-col-md12">
    <form class="layui-card-body layui-form layui-form-pane">
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8">
          <label class="layui-form-label">标题：</label>
          <div class="layui-input-block">
            <input type="text" name="title" lay-verify="required" value="{$info.title}" lay-reqtext="请输入标题" placeholder="请输入标题" autocomplete="off" class="layui-input">
          </div>
        </div>
      </div>
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8">
          <label class="layui-form-label">所属栏目：</label>
          <div class="layui-input-block">
            <select name="cate_id" disabled="disabled" lay-verify="required" lay-reqtext="请选择所属栏目" lay-search>
              <option value="">请选择所属栏目</option>
              {volist name="$cate_list" id="vo"}
              <option {$info['cate_id']==$vo['cate_id']?'selected':''} value="{$vo.cate_id}">{$vo.prefix}{$vo.cate_name}</option>
              {/volist}
            </select>
          </div>
        </div>
      </div>
      {if condition="$info.cate_id != 2"}
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8">
          <label class="layui-form-label">详情：</label>
          <div class="layui-input-block">
            <textarea name="content" id="content">{$info.content}</textarea>
          </div>
        </div>
      </div>
      {/if}
      {if condition="$info.cate_id == 2"}
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8">
          <label class="layui-form-label">链接：</label>
          <div class="layui-input-block">
            <input type="text" name="linkurl" value="{$info.linkurl}" lay-verify="required" lay-reqtext="请输入外链链接" placeholder="请输入外链链接" autocomplete="off" class="layui-input">
          </div>
        </div>
      </div>
      {/if}
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8">
          <label class="layui-form-label">排序ID：</label>
          <div class="layui-input-block">
            <input type="text" name="order_id" lay-verify="required" lay-reqtext="请输入排序id" value="{$info.order_id}" placeholder="请输入排序id" autocomplete="off" class="layui-input">
          </div>
        </div>
      </div>
      <div class="layui-row layui-col-space10 layui-form-item">
        <div class="layui-col-lg8">
          <label class="layui-form-label">是否显示：</label>
          <div class="layui-input-block">
            <input type="radio" name="status" value="1" title="显示" {$info.status==1?'checked':''}>
            <input type="radio" name="status" value="0" title="不显示" {$info.status==0?'checked':''}>
          </div>
        </div>
      </div>
      <!-- 底部操作按钮 -->
      <div class="layui-row">
        <div class="layui-col-xs3">&nbsp;</div>
        <div class="layui-col-xs4">
          <input type="hidden" name="act" value="edit" />
          <input type="hidden" name="artice_id" value="{$info.artice_id}" />
          <input type="hidden" name="cate_id" value="{$info.cate_id}" />
          <button type="button" class="layui-btn layui-btn-primary layui-btn-radius" id="backList"><i class="layui-icon">&#xe65c;</i>返回列表</button>
          <button type="button" class="layui-btn layui-btn-normal layui-btn-radius" lay-submit lay-filter="saveBtn"><i class="layui-icon">&#xe609;</i>立即更新</button>
        </div>
        <div class="layui-col-xs5">&nbsp;</div>
      </div>
      <!-- 底部操作按钮结束 -->
    </form>
  </div>
</div>
{/block}
{block name="myScript"}
<script>
  layui.use(['form', 'upload'], function() {
    var form = layui.form,
      upload = layui.upload,
      layer = layui.layer,
      $ = layui.$;
    //监听提交
    form.on('submit(saveBtn)', function(data) {
      var data = data.field,
        url = "{:url('/'.config('manage.manage_name').'/'.config('manage.version').'/Artice/Save')}";
      https(url, data, 'post', 1, '正在保存信息').then(res => {
        xkMsg(res.result_msg);
      }, fail => {})
      return false;
    });
  });
</script>
{/block}
